<template>
  <view class="account" :class="{'has': info.level > 0}">
    <v-vip :vip="vip" v-if="info.level <= 0" />
    <view class="account-item" v-for="(item, index) in account" :key="index" @click="goAccount(item)">
      <view class="num">{{ item.total }}</view>
      <view class="text">{{ item.text }}</view>
    </view>
  </view>
</template>

<script>
import Vip from './Vip'
import { mapGetters } from 'vuex'

export default {
  props: ['account', 'vip'],
  components: {
    'v-vip': Vip
  },
  computed: {
    ...mapGetters({
      info: 'User/info'
    })
  },
  data() {
    return {
    }
  },
  methods: {
    // 帐户点击
    goAccount(item) {
      uni.navigateTo({
        url: item.url
      })
    },
  }
}

</script>

<style scoped lang="scss">
.account {
  position: relative;
  height: 180rpx;
  margin: 70rpx 20rpx 20rpx 20rpx;
  background: white;
  border-radius: 10rpx;
  display: flex;
  padding: 40rpx;
  justify-content: space-around;
  box-sizing: border-box;
  &.has {
    margin-top: 20rpx;
  }
  .account-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: baseline;
    text-align: center;
    .num, .text {
      flex: 1;
      width: 100%;
      //background: red;
      font-size: 30rpx;
    }
    .num {
      color: red;
      font-weight: 700;
      font-size: 36rpx;
    }
  }
}
</style>
